package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * 客户沟通表
 */
@Entity
@Table(name = "Interflow", schema = "springboot", catalog = "")
public class Interflow {
    private int flowId;             //客户沟通id
    private String flowGist;        //沟通要点
    private String flowResult;      //确认结果
    private String flowCrew;        //确认人员
    private Timestamp flowDate;     //确认日期
    private Maintain maintainByTainId;

    public Interflow() {

    }

    public Interflow(int flowId, String flowGist, String flowResult, String flowCrew, Timestamp flowDate, Maintain maintainByTainId) {
        this.flowId = flowId;
        this.flowGist = flowGist;
        this.flowResult = flowResult;
        this.flowCrew = flowCrew;
        this.flowDate = flowDate;
        this.maintainByTainId = maintainByTainId;
    }

    @Id
    @Column(name = "flow_id")
    public int getFlowId() {
        return flowId;
    }

    public void setFlowId(int flowId) {
        this.flowId = flowId;
    }

    @Basic
    @Column(name = "flow_gist")
    public String getFlowGist() {
        return flowGist;
    }

    public void setFlowGist(String flowGist) {
        this.flowGist = flowGist;
    }

    @Basic
    @Column(name = "flow_result")
    public String getFlowResult() {
        return flowResult;
    }

    public void setFlowResult(String flowResult) {
        this.flowResult = flowResult;
    }

    @Basic
    @Column(name = "flow_crew")
    public String getFlowCrew() {
        return flowCrew;
    }

    public void setFlowCrew(String flowCrew) {
        this.flowCrew = flowCrew;
    }

    @Basic
    @Column(name = "flow_date")
    public Timestamp getFlowDate() {
        return flowDate;
    }

    public void setFlowDate(Timestamp flowDate) {
        this.flowDate = flowDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Interflow interflow = (Interflow) o;
        return flowId == interflow.flowId &&
                Objects.equals(flowGist, interflow.flowGist) &&
                Objects.equals(flowResult, interflow.flowResult) &&
                Objects.equals(flowCrew, interflow.flowCrew) &&
                Objects.equals(flowDate, interflow.flowDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(flowId, flowGist, flowResult, flowCrew, flowDate);
    }

    @ManyToOne
    @JoinColumn(name = "tain_id", referencedColumnName = "tain_id")
    public Maintain getMaintainByTainId() {
        return maintainByTainId;
    }

    public void setMaintainByTainId(Maintain maintainByTainId) {
        this.maintainByTainId = maintainByTainId;
    }

    @Override
    public String toString() {
        return "Interflow{" +
                "flowId=" + flowId +
                ", flowGist='" + flowGist + '\'' +
                ", flowResult='" + flowResult + '\'' +
                ", flowCrew='" + flowCrew + '\'' +
                ", flowDate=" + flowDate +
                ", maintainByTainId=" + maintainByTainId +
                '}';
    }
}
